using System;

namespace Triton.Game
{
	public class PerFrameCachedValue<T> : PerCachedValue<T>
	{
		private uint uint_0;

		public PerFrameCachedValue(Func<T> producer)
			: base(producer)
		{
			uint_0 = uint.MaxValue;
		}

		protected override bool ShouldUpdateCache(bool force)
		{
			uint frameCount = TritonHs.Memory.Executor.FrameCount;
			if (uint_0 != frameCount || force)
			{
				uint_0 = frameCount;
				return true;
			}
			return false;
		}
	}
}
